USE [vudu]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[InsertarRolEscuela]

	@correo Varchar(50),
	@clave Varchar(50),
	@id_escuela int
	AS
BEGIN

	SET NOCOUNT ON;

	INSERT INTO [dbo].[ROL]
	(correo, pass, tipo_rol)
	VALUES(@correo, @clave,'Escuela');
	update Escuela Set estadoRol = 'Activo' , fk_rol=(Select MAX(id_rol) from rol )
	where id_Escuela = @id_escuela;
END
GO